<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition>
		<div class="menu-body-search" style="background-color: ##{searchImovelController.cliente.template.corFundoMenuBusca};">
			<h:form id="search-imoveis">
				<table cellpadding="0" cellspacing="0">
					<tr>
						<td>
							<h:selectOneMenu id="modalidade" styleClass="selectOneMenuTemplate" value="#{searchImovelController.tipoNegociacao}">
               					<f:selectItems value="#{searchImovelController.tiposNegociacao}" var="tipo" itemLabel="#{tipo}" itemValue="#{tipo.value}"/>
              				</h:selectOneMenu>												
						</td>										
					</tr>
					<tr><td><p:spacer height="15px"/></td></tr>										
					<tr>
						<td align="left">
							<b><h:outputText value="#{msg['template.localidade.title']}" /></b>
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td align="left">
							<h:selectOneMenu id="slc_estado" styleClass="selectOneMenuTemplate" converter="#{simpleEntityConverter}" value="#{searchImovelController.estado}">		               		
		               			<f:selectItems value="#{searchImovelController.estados}" var="estado" itemLabel="#{estado.nome}" itemValue="#{estado}" />
		               			<f:ajax listener="#{searchImovelController.reloadMunicipios}" event="change" execute="@this" render="slc_municipio" />  
	            			</h:selectOneMenu>
						</td>
					</tr>
					<tr><td><p:spacer height="5px"/></td></tr>
					<tr>
						<td>
							<h:selectOneMenu id="slc_municipio" styleClass="selectOneMenuTemplate" value="#{searchImovelController.municipio.id}">
		               			<f:selectItems value="#{searchImovelController.municipios}" var="municipio" itemLabel="#{municipio.nome}" itemValue="#{municipio.id}" />
		               			<f:ajax listener="#{searchImovelController.reloadBairros}" event="change" execute="@this" render="slc_bairros" />
		               		</h:selectOneMenu>
		               	</td>
					</tr>
					<tr><td><p:spacer height="5px"/></td></tr>
					<tr>
						<td>
							<h:selectManyListbox id="slc_bairros" style="width:190px;height:50px;" value="#{searchImovelController.selectedBairro}">
		               			<f:selectItems value="#{searchImovelController.bairros}" var="bairro" itemLabel="#{bairro}" itemValue="#{bairro}"/>
		               		</h:selectManyListbox>
		               	</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td align="left">
							<h:selectBooleanCheckbox id="foto" value="#{searchImovelController.album}"/>
							<p:spacer width="5px"/><h:outputText value="#{msg['template.album.title']}" />
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td align="left">
							<b><h:outputText value="#{msg['template.dormitorios.title']}" /></b>
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td>
							<h:selectOneMenu id="dormitorios" styleClass="selectOneMenuTemplate" value="#{searchImovelController.dormitorios}">
								<f:selectItem itemLabel="#{msg['template.selecione.option.label']}" itemValue=""/>
								<f:selectItem itemLabel="1 - Dormitório" itemValue="1"/>
								<f:selectItem itemLabel="2 - Dormitórios" itemValue="2"/>
								<f:selectItem itemLabel="3 - Dormitórios" itemValue="3"/>
								<f:selectItem itemLabel="4 - Dormitórios" itemValue="4"/>
								<f:selectItem itemLabel="5 - Dormitórios" itemValue="5"/>
								<f:selectItem itemLabel="6 - Dormitórios" itemValue="6"/>
								<f:selectItem itemLabel="7 - Dormitórios" itemValue="7"/>
								<f:selectItem itemLabel="8 ou + Dormitórios" itemValue="8"/>
							</h:selectOneMenu>								
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td align="left">
							<b><h:outputText value="#{msg['template.suites.title']}" /> </b>
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td>
							<h:selectOneMenu id="suites" styleClass="selectOneMenuTemplate" value="#{searchImovelController.suites}">
								<f:selectItem itemLabel="#{msg['template.selecione.option.label']}" itemValue=""/>
								<f:selectItem itemLabel="1 - Suíte" itemValue="1"/>
								<f:selectItem itemLabel="2 - Suítes" itemValue="2"/>
								<f:selectItem itemLabel="3 - Suítes" itemValue="3"/>
								<f:selectItem itemLabel="4 - Suítes" itemValue="4"/>
								<f:selectItem itemLabel="5 ou + Suítes" itemValue="5"/>
							</h:selectOneMenu>													
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td align="left">
							<b><h:outputText value="#{msg['template.banheiros.title']}" /> </b>
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td>
							<h:selectOneMenu id="banheiros" styleClass="selectOneMenuTemplate" value="#{searchImovelController.banheiros}">
								<f:selectItem itemLabel="#{msg['template.selecione.option.label']}" itemValue=""/>
								<f:selectItem itemLabel="1 - Banheiro" itemValue="1"/>
								<f:selectItem itemLabel="2 - Banheiros" itemValue="2"/>
								<f:selectItem itemLabel="3 - Banheiros" itemValue="3"/>
								<f:selectItem itemLabel="4 - Banheiros" itemValue="4"/>
								<f:selectItem itemLabel="5 ou + Banheiros" itemValue="5"/>
							</h:selectOneMenu>												
						</td>
					</tr>
					<tr><td><p:spacer height="10px"/></td></tr>
					<tr>
						<td align="left">
							<b><h:outputText value="#{msg['template.garagens.title']}" /> </b>
						</td>
					</tr>	
					<tr>
						<td>
							<h:selectOneMenu id="garagens" styleClass="selectOneMenuTemplate" value="#{searchImovelController.garagens}">
								<f:selectItem itemLabel="#{msg['template.selecione.option.label']}" itemValue=""/>
								<f:selectItem itemLabel="1 - Garagem" itemValue="1"/>
								<f:selectItem itemLabel="2 - Garagens" itemValue="2"/>
								<f:selectItem itemLabel="3 - Garagens" itemValue="3"/>
								<f:selectItem itemLabel="4 - Garagens" itemValue="4"/>
								<f:selectItem itemLabel="5 ou + Garagens" itemValue="5"/>
							</h:selectOneMenu>													
						</td>
					</tr>
					<tr><td><p:spacer height="15px"/></td></tr>
					<tr>
						<td class="button-bar">
							<p:commandButton value="#{msg['search.menu.button.buscar']}" ajax="false" actionListener="#{searchImovelController.search}" icon="search-button"/>
						</td>
					</tr>
				</table>
			</h:form>
		</div>		
		<p:spacer height="10px"/>
		<div class="destaquebar" style="background-color: ##{searchImovelController.cliente.template.corFundoDestaque};">
			<h:form id="formDestaque">
				<table cellpadding="0" cellspacing="0" class="top-destaques">
					<tr>
						<td colspan="2"><span style="font-size: 14px;"><b><h:outputText value="#{msg['template.destaque.title']}" /></b></span></td>
					</tr>
					<tr>
						<td colspan="2"><p:spacer height="5px"/> </td>
					</tr>
					<tr>
						<td colspan="2" style="text-align:center;height:165px;">					
							<p:commandLink oncomplete="destaqueDialog.show()" update=":destaque-panel"
								actionListener="#{searchImovelController.loadImovelById}">
								<f:param name="idImovel" value="#{searchImovelController.destaque.id}" />																		
								<p:graphicImage value="#{searchImovelController.destaque.logo}" />
							</p:commandLink>
						</td>
					</tr>
					<tr>
						<td colspan="2"><p:spacer height="10px"/></td>
					</tr>
					<tr>
						<td style="width:100px;height: 25px;border-bottom: 1px solid;"><b><h:outputText value="#{msg['template.destaque.empreendimento']}" />:</b></td>
						<td style="height: 25px;border-bottom: 1px solid;"><h:outputText value="#{searchImovelController.destaque.empresa.endereco.edificio}" /></td>
					</tr>
					<tr>
						<td style="width:100px;height: 25px;border-bottom: 1px solid;"><b><h:outputText value="#{msg['template.destaque.cidade']}" />:</b></td>
						<td style="height: 25px;border-bottom: 1px solid;"><h:outputText value="#{searchImovelController.destaque.empresa.endereco.municipio.nome}" /></td>
					</tr>
					<tr>
						<td style="width:100px;height: 25px;border-bottom: 1px solid;"><b><h:outputText value="#{msg['template.destaque.bairro']}" />:</b></td>
						<td style="height: 25px;border-bottom: 1px solid;"><h:outputText value="#{searchImovelController.destaque.empresa.endereco.bairro}" /></td>
					</tr>
					<tr>
						<td style="width:100px;height: 25px;border-bottom: 1px solid;"><b><h:outputText value="#{msg['template.destaque.tipo']}" />:</b></td>
						<td style="height: 25px;border-bottom: 1px solid;"><h:outputText value="#{searchImovelController.destaque.subCategoria.categoria.nome}" /></td>
					</tr>
					<tr>
						<td style="width:100px;height: 25px;border-bottom: 1px solid;"><b><h:outputText value="#{msg['template.destaque.dormitorios']}" />:</b></td>
						<td style="height: 25px;border-bottom: 1px solid;"><h:outputText value="#{searchImovelController.destaque.dormitorios}" /></td>
					</tr>
					<tr>
						<td style="width:100px;height: 25px;border-bottom: 1px solid;"><b><h:outputText value="#{msg['template.destaque.opcao']}" />:</b></td>
						<td style="height: 25px;border-bottom: 1px solid;"><h:outputText value="#{searchImovelController.destaque.subCategoria.nome}" /></td>
					</tr>
				</table>
			</h:form>
		</div>			
		<p:dialog header="#{msg['body.header.menu.destaques.detalhes']}" widgetVar="destaqueDialog" resizable="false" 
			modal="true" styleClass="dialog" showEffect="clip" position="top" width="520">        	
			<p:outputPanel id="destaque-panel">
				<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.codigo']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<b><h:outputText value="#{searchImovelController.imovel.id}" /></b>
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.titulo']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.pessoaJuridica.nome}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.tipo']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.tipoNegociacaoDesc}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.categoria']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.subCategoria.categoria.nome}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.dormitorios']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.dormitorios}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.suites']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.suites}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.banheiros']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.banheiros}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.garagens']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.garagens}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.areaUtil']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.areaUtil}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.preco']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{imovel.preco}">
								<f:convertNumber pattern = "#,###.00"/>
							</h:outputText>
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.descricao']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.descricao}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.rua']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.endereco.rua}" />,<h:outputText value="#{searchImovelController.imovel.empresa.endereco.numero}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.bairro']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.endereco.bairro}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.menuleft.destaque.cidade']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.endereco.municipio.nome}" />/<h:outputText value="#{searchImovelController.imovel.empresa.endereco.municipio.estado.sigla}" />
						</td>
					</tr>					
					
				</table>		
				<p:spacer height="20px"/>
				<p:commandButton type="button" onclick="switcherImovel.previous();" icon="ui-icon-circle-triangle-w" />  
				<p:spacer height="10px;" width="10px"/>
				<p:commandButton type="button" onclick="switcherImovel.next();" icon="ui-icon-circle-triangle-e"/>  
				
				<p:separator style="width:100%;height:1px;" />
				
				<p:imageSwitch effect="wipe" widgetVar="switcherImovel" slideshowAuto="false" style="display: block;margin-left: auto;margin-right: auto;">  
				    <ui:repeat value="#{searchImovelController.imovel.album}" var="image">  
				        <p:graphicImage value="#{image.originalImage}"/>  
				    </ui:repeat>  
				</p:imageSwitch> 					
				
			</p:outputPanel>         	
		</p:dialog>	
	</ui:composition>
	
</html>